﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Commander.Models.Dashboard;

namespace Commander.Controllers {
  public class DashboardController : Controller {
    //
    // GET: /Dashboard/
    static SelectList dropDownData;
    static ProjectModel selectedProject;
    UserDashboardModel model;
    public ActionResult Index() {
      model = TempData["user"] as UserDashboardModel;
      selectedProject = model.Projects[0];
      ViewData.Model = model;
      dropDownData = new SelectList(model.Projects, "Name", "Name"); ;
      ViewData["dropdowndata"] = dropDownData;
      return View();
    }

    //TODO: modify to use the name of trhe selected element to find the proper project, and set a TempData key
    //      to the proper ProjectModel
    public ActionResult Project(string name) {
      TempData["project"] = selectedProject;
      return RedirectToAction("Index", "Project");
    }

  }
}
